//Replication files for Owsiak, Andrew P., and John A. Vasquez. 2021. Peaceful Dyads: A Territorial Perspective. International Interactions.

use "peaceful dyads replication.dta", replace

//Table 1. Text only. No replication.

//Table 2. 
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 if rel_everpolrel2==1
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 rel_meancinc2 rel_meantrade2 if rel_everpolrel2==1
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 if rel_anymidsall==1
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 rel_meancinc2 rel_meantrade2 if rel_anymidsall==1

//Table 3.
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 if rel_everpolrel3==1
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 rel_meancinc3 rel_meantrade3 if rel_everpolrel3==1
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 if rel_anymidsall==1
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 rel_meancinc3 rel_meantrade3 if rel_anymidsall==1

//Table 4. Note focus on peaceful dyads; for space, pull only second row of the crosstab (i.e., the peaceful dyads).
tab rel_neverwar2 rel_anyterrmids2 if rel_everpolrel2==1, r chi2 lrchi2
tab rel_neverwar3 rel_anyterrmids3 if rel_everpolrel3==1, r chi2 lrchi2
tab rel_neverwar2 rel_anyterrmids2 if rel_anymidsall==1, r chi2 lrchi2
tab rel_neverwar3 rel_anyterrmids3 if rel_anymidsall==1, r chi2 lrchi2

//Table 5. Note focus on peaceful dyads; for space, pull only second row of the crosstab (i.e., the peaceful dyads).
tab rel_neverwar2 rel_alwaysjtdem2 if rel_everpolrel2==1, r chi2 lrchi2
tab rel_neverwar3 rel_alwaysjtdem3 if rel_everpolrel3==1, r chi2 lrchi2
tab rel_neverwar2 rel_alwaysjtdem2 if rel_anymidsall==1, r chi2 lrchi2
tab rel_neverwar3 rel_alwaysjtdem3 if rel_anymidsall==1, r chi2 lrchi2

//Table 6. Note focus on democratic dyads; for space, pull only second row of the crosstab (i.e., the democratic dyads).
tab rel_alwaysjtdem2 rel_anyterrmids2 if rel_everpolrel2==1, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyterrmids3 if rel_everpolrel3==1, r chi2 lrchi2
tab rel_alwaysjtdem2 rel_anyterrmids2 if rel_anymidsall==1, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyterrmids3 if rel_anymidsall==1, r chi2 lrchi2

//Table 7. Note focus on democratic dyads; for space, pull only second row of the crosstab (i.e., the democratic dyads).
tab rel_alwaysjtdem2 rel_anyicowterr2 if rel_everpolrel2==1, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyicowterr3 if rel_everpolrel3==1, r chi2 lrchi2
tab rel_alwaysjtdem2 rel_anyicowterr2 if rel_anymidsall==1, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyicowterr3 if rel_anymidsall==1, r chi2 lrchi2

//Online Appendix.
//Table A1.
tab rel_anywarall
tab rel_anywar1
tab rel_anywar2
tab rel_anywar3

tab rel_anywarall if rel_everpolrelall==1
tab rel_anywar1 if rel_everpolrel1==1
tab rel_anywar2 if rel_everpolrel2==1
tab rel_anywar3 if rel_everpolrel3==1

tab rel_anywarall if rel_anymidsall==1
tab rel_anywar1 if rel_anymidsall==1
tab rel_anywar2 if rel_anymidsall==1
tab rel_anywar3 if rel_anymidsall==1

//Table A2.
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 rel_meancinc2 rel_meantrade2 
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 rel_meancinc3 rel_meantrade3 

//Table A3. 
tab rel_neverwar2 rel_anyterrmids2, r chi2 lrchi2
tab rel_neverwar3 rel_anyterrmids3, r chi2 lrchi2

//Table A4. 
tab rel_neverwar2 rel_alwaysjtdem2, r chi2 lrchi2
tab rel_neverwar3 rel_alwaysjtdem3, r chi2 lrchi2

//Table A5.
tab rel_alwaysjtdem2 rel_anyterrmids2, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyterrmids3, r chi2 lrchi2

//Table A6.
tab rel_alwaysjtdem2 rel_anyicowterr2, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyicowterr3, r chi2 lrchi2

//Table A7.
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall 
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall rel_meancincall rel_meantradeall 
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall if rel_everpolrelall==1
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall rel_meancincall rel_meantradeall if rel_everpolrelall==1
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall if rel_anymidsall==1 
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall rel_meancincall rel_meantradeall if rel_anymidsall==1

//Table A8.
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1 
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1 rel_meancinc1 rel_meantrade1
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1  if rel_everpolrel1==1
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1 rel_meancinc1 rel_meantrade1 if rel_everpolrel1==1
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1  if rel_anymidsall==1 
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1 rel_meancinc1 rel_meantrade1 if rel_anymidsall==1

//Table A9.
tab rel_neverwarall rel_anyterrmidsall, r chi2 lrchi2
tab rel_neverwar1 rel_anyterrmids1, r chi2 lrchi2
tab rel_neverwarall rel_anyterrmidsall if rel_everpolrelall==1, r chi2 lrchi2 
tab rel_neverwar1 rel_anyterrmids1 if rel_everpolrel1==1, r chi2 lrchi2  
tab rel_neverwarall rel_anyterrmidsall if rel_anymidsall==1, r chi2 lrchi2 
tab rel_neverwar1 rel_anyterrmids1 if rel_anymidsall==1, r chi2 lrchi2 

//Table A10.
tab rel_neverwarall rel_alwaysjtdemall, r chi2 lrchi2
tab rel_neverwar1 rel_alwaysjtdem1, r chi2 lrchi2
tab rel_neverwarall rel_alwaysjtdemall if rel_everpolrelall==1, r chi2 lrchi2 
tab rel_neverwar1 rel_alwaysjtdem1 if rel_everpolrel1==1, r chi2 lrchi2  
tab rel_neverwarall rel_alwaysjtdemall if rel_anymidsall==1, r chi2 lrchi2 
tab rel_neverwar1 rel_alwaysjtdem1 if rel_anymidsall==1, r chi2 lrchi2 

//Table A11.
tab  rel_alwaysjtdemall rel_anyterrmidsall, r chi2 lrchi2
tab  rel_alwaysjtdem1 rel_anyterrmids1, r chi2 lrchi2
tab  rel_alwaysjtdemall rel_anyterrmidsall if rel_everpolrelall==1, r chi2 lrchi2 
tab  rel_alwaysjtdem1 rel_anyterrmids1 if rel_everpolrel1==1, r chi2 lrchi2  
tab  rel_alwaysjtdemall rel_anyterrmidsall if rel_anymidsall==1, r chi2 lrchi2 
tab  rel_alwaysjtdem1 rel_anyterrmids1 if rel_anymidsall==1, r chi2 lrchi2 

//Appendix B. 
//Table B1.
firthlogit rel_neverwar2 rel_anyterrmids2 rel_everjtdem2 rel_meancinc2 rel_meantrade2
firthlogit rel_neverwar3 rel_anyterrmids3 rel_everjtdem3 rel_meancinc3 rel_meantrade3
firthlogit rel_neverwar2 rel_anyterrmids2 rel_everjtdem2 rel_meancinc2 rel_meantrade2 if rel_everpolrel2==1
firthlogit rel_neverwar3 rel_anyterrmids3 rel_everjtdem3 rel_meancinc3 rel_meantrade3 if rel_everpolrel3==1
firthlogit rel_neverwar2 rel_anyterrmids2 rel_everjtdem2 rel_meancinc2 rel_meantrade2 if rel_anymidsall==1
firthlogit rel_neverwar3 rel_anyterrmids3 rel_everjtdem3 rel_meancinc3 rel_meantrade3 if rel_anymidsall==1

//Table B2.
tab rel_neverwar2 rel_everjtdem2, r chi2 lrchi2 
tab rel_neverwar3 rel_everjtdem3, r chi2 lrchi2 
tab rel_neverwar2 rel_everjtdem2 if rel_everpolrel2==1, r chi2 lrchi2 
tab rel_neverwar3 rel_everjtdem3 if rel_everpolrel3==1, r chi2 lrchi2 
tab rel_neverwar2 rel_everjtdem2 if rel_anymidsall==1, r chi2 lrchi2 
tab rel_neverwar3 rel_everjtdem3 if rel_anymidsall==1, r chi2 lrchi2 

//Table B3.
tab  rel_everjtdem2 rel_anyterrmids2, r chi2 lrchi2
tab  rel_everjtdem3 rel_anyterrmids3, r chi2 lrchi2
tab  rel_everjtdem2 rel_anyterrmids2 if rel_everpolrel2==1, r chi2 lrchi2 
tab  rel_everjtdem3 rel_anyterrmids3 if rel_everpolrel3==1, r chi2 lrchi2  
tab  rel_everjtdem2 rel_anyterrmids2 if rel_anymidsall==1, r chi2 lrchi2 
tab  rel_everjtdem3 rel_anyterrmids3 if rel_anymidsall==1, r chi2 lrchi2 

//Table B4.
firthlogit rel_neverfatalmids2 rel_anyterrmids2 rel_alwaysjtdem2 rel_meancinc2 rel_meantrade2
firthlogit rel_neverfatalmids3 rel_anyterrmids3 rel_alwaysjtdem3 rel_meancinc3 rel_meantrade3
firthlogit rel_neverfatalmids2 rel_anyterrmids2 rel_alwaysjtdem2 rel_meancinc2 rel_meantrade2 if rel_everpolrel2==1
firthlogit rel_neverfatalmids3 rel_anyterrmids3 rel_alwaysjtdem3 rel_meancinc3 rel_meantrade3 if rel_everpolrel3==1

//Table B5.
tab rel_neverfatalmids2 rel_anyterrmids2, r chi2 lrchi2 
tab rel_neverfatalmids3 rel_anyterrmids3, r chi2 lrchi2 
tab rel_neverfatalmids2 rel_anyterrmids2 if rel_everpolrel2==1, r chi2 lrchi2 
tab rel_neverfatalmids3 rel_anyterrmids3 if rel_everpolrel3==1, r chi2 lrchi2

//Table B6.
tab rel_neverfatalmids2 rel_alwaysjtdem2, r chi2 lrchi2 
tab rel_neverfatalmids3 rel_alwaysjtdem3, r chi2 lrchi2 
tab rel_neverfatalmids2 rel_alwaysjtdem2 if rel_everpolrel2==1, r chi2 lrchi2 
tab rel_neverfatalmids3 rel_alwaysjtdem3 if rel_everpolrel3==1, r chi2 lrchi2

//Table B7.
use "mid escalation.dta", replace
firthlogit peace territory jtdem if flagwar==0 & per2==1
firthlogit peace territory jtdem cincratio totaltrade if flagwar==0 & per2==1 
firthlogit peace territory jtdem if flagwar==0 & per3==1
firthlogit peace territory jtdem cincratio totaltrade if flagwar==0 & per3==1 

//Table B8. Take peace rows (war=0).
tab war territory if per2==1, r chi2 lrchi2
tab war territory if per3==1, r chi2 lrchi2
tab war jtdem if per2==1, r chi2 lrchi2
tab war jtdem if per3==1, r chi2 lrchi2

//Table B9. Take peace rows (fatalmid=0).
tab fatalmid territory if per2==1, r chi2 lrchi2
tab fatalmid territory if per3==1, r chi2 lrchi2
tab fatalmid jtdem if per2==1, r chi2 lrchi2
tab fatalmid jtdem if per3==1, r chi2 lrchi2

